﻿using System.Collections.Generic;

namespace StockLib.Indicator
{
    public partial class StockAmoIndicator : StockIndicator
    {
        private List<int> maDays = new List<int>();

        public StockAmoIndicator()
            : base()
        {
            cacheCount = 3;
        }

        public override void SetDefaultParameters()
        {
            maDays.Clear();
            maDays.Add(6);
            maDays.Add(12);
            maDays.Add(24);
        }

        public override void CalcMinMax()
        {
            base.CalcMinMax();

            for (int i = indexStart; i <= indexEnd; i++)
            {
                if (kData[i].Amount > valueMax)
                    valueMax = kData[i].Amount;

                if (kData[i].Amount < valueMin)
                    valueMin = kData[i].Amount;
            }
        }

        protected override float[] CalcOutput(int index)
        {
            float[] values = new float[3];

            for (int i = 0; i < values.Length; i++)
            {
                values[i] = CalcAmountMaCache(index, maDays[i], i);
            }

            return values;
        }
    }
}
